<?php

/**
 * @author dr4g0n
 * @copyright 2008
 */
include_once("string.php");
include_once("install.php");

class bench {

    private $start_time;

    /**
     * Start benchmark
     */
    public function start() {
        $this->start_time = microtime(true);
    }

    /**
     * End benchmark
     * 
     * @return int
     * Time between start and end
     */
    public function end() {
        return microtime(true) - $this->start_time;
    }

    /**
     * Benchmark code execution
     * 
     * @param type $code
     * Code to execute
     * @return int
     * Time between start and end
     */
    public function bench_code($code) {
        $start_time = microtime(true);
        eval($code);
        return microtime(true) - $start_time;
    }

}

?>